package utils;

import lombok.Data;

import java.io.Serializable;

/**
 * @author wfh
 */
@Data
public class ResponseBean implements Serializable {
    private int code;
    private String message;
    private Object data;


    public static ResponseBean secucess(Object data) {
        ResponseBean responseBean = new ResponseBean();
        responseBean.setCode(200);
        responseBean.setData(data);
        responseBean.setMessage("操作成功!");
        return responseBean;
    }

    public static ResponseBean fail() {
        ResponseBean responseBean = new ResponseBean();
        responseBean.setCode(501);
        responseBean.setData("");
        responseBean.setMessage("操作失败!");
        return responseBean;
    }

    public static ResponseBean fail(Object data) {
        ResponseBean responseBean = new ResponseBean();
        responseBean.setCode(501);
        responseBean.setData(data);
        responseBean.setMessage("操作失败!");
        return responseBean;
    }

}
